﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LocalizerUtility
{
    public class Localization
    {
        private List<LocalizedData> dataArray;

        public Localization()
        {
            dataArray = new List<LocalizedData>();
        }

        public bool AddItem(LocalizedData newItem)
        {
            bool isDuplicateRegionId = false;
            foreach (LocalizedData locData in dataArray)
            {
                if (newItem.RegionId == locData.RegionId)
                {
                    isDuplicateRegionId = true;
                    break;
                }
            }
            if (!isDuplicateRegionId)
            {
                dataArray.Add(newItem);
            }
            return isDuplicateRegionId;
        }

        public LocalizedData GetItem(int i)
        {
            if ((i < 0) || (i >= dataArray.Count))
            {
                return null;
            }
            return dataArray[i];
        }

        public int Count()
        {
            return dataArray.Count;
        }
    }
}
